<!doctype html>
[#escape x as (x)!?html]
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>${channel.title} - ${site.title}</title>
  <meta name="keywords" content="${channel.seoKeywords}">
  <meta name="description" content="${channel.seoDescription}">
  <meta name="_csrf" content="${_csrf.token}"/>
  <meta name="_csrf_header" content="${_csrf.headerName}"/>
  [#include 'inc_meta.html'/]
  [#include 'inc_css.html'/]
  [#include 'inc_js.html'/]
  [#if config.greyStyle]
    <style>
      body {
        filter: grayscale(.95);
        -webkit-filter: grayscale(.95);
      }
    </style>
  [/#if]
</head>
<body>
[#include 'inc_header.html'/]

<div class="container mt-3">
  <div class="row">
    <div class="col-lg-12">
      <!-- 离校状态总览 -->
      <div class="card">
        <div class="card-header d-flex justify-content-between align-items-center">
          <h5 class="mb-0"><i class="fas fa-graduation-cap"></i> 离校状态总览</h5>
          <button type="button" class="btn btn btn-primary " onclick="showGraduationModal()">
            <i class="fas fa-plus"></i> 申请离校
          </button>
        </div>
        <div class="card-body">
          <div class="row text-center mb-4">
            <div class="col-md-3">
              <div class="card text-center">
                <div class="card-body">
                  <h3 class="text-info ">75%</h3>
                  <p class="text-muted">完成进度</p>
                </div>
              </div>
            </div>
            <div class="col-md-3">
              <div class="card text-center">
                <div class="card-body">
                  <h6 class="mb-1">清欠项目</h6>
                  <div class="progress" style="height: 6px;">
                    <div class="progress-bar bg-success" style="width: 50%"></div>
                  </div>
                  <p class="text-muted small">2/4 完成</p>
                </div>
              </div>
            </div>
            <div class="col-md-3">
              <div class="card text-center">
                <div class="card-body">
                  <h6 class="mb-1">预计完成时间</h6>
                  <p class="text-muted">2024-04-18</p>
                </div>
              </div>
            </div>
            <div class="col-md-3">
              <div class="card text-center">
                <div class="card-body">
                  <h6 class="mb-1">离校类型</h6>
                  <p class="text-muted">毕业离校</p>
                </div>
              </div>
            </div>
          </div>

          <!-- 状态详情 -->
          <div class="row">
            <div class="col-md-6">
              <h6><i class="fas fa-check-circle text-success"></i> 图书馆环节</h6>
              <span class="badge badge-success">已完成</span>
            </div>
            <div class="col-md-6">
              <h6><i class="fas fa-info-circle text-warning"></i> 财务处环节</h6>
              <span class="badge badge-warning">处理中</span>
            </div>
            <div class="col-md-6">
              <h6><i class="fas fa-building text-info"></i> 学院环节</h6>
              <span class="badge badge-secondary">待办理</span>
            </div>
            <div class="col-md-6">
              <h6><i class="fas fa-user-tie text-secondary"></i> 宿舍环节</h6>
              <span class="badge badge-secondary">待办理</span>
            </div>
          </div>
        </div>

          <div class="alert alert-info mt-3" role="alert">
            <i class="fas fa-info-circle"></i>
            <strong>温馨提醒：</strong>请确保在毕业前完成所有图书馆环节的手续办理，以免影响离校进度。
          </div>
        </div>
      </div>

      <!-- 清欠指引 -->
      <div class="card mb-4">
        <div class="card-header">
          <h5 class="mb-0"><i class="fas fa-clipboard-list"></i> 清欠指引</h5>
        </div>
        <div class="card-body">
          <div class="row">
            <div class="col-md-6">
              <div class="card text-center">
                <div class="card-body">
                  <h6 class="mb-3"><i class="fas fa-book"></i> 归还借阅图书</h6>
                  <p class="text-muted mb-2">到图书馆总服务台归还所有借阅的图书</p>
                  <div class="text-muted">
                    <i class="fas fa-clock"></i> 时间：8:00-22:00<br>
                    <i class="fas fa-map-marker-alt"></i> 地点：图书馆一楼总服务台
                  </div>
                </div>
              </div>
            </div>
            <div class="col-md-6">
              <div class="card text-center">
                <div class="card-body">
                  <h6 class="mb-3"><i class="fas fa-money-bill-wave"></i> 缴清欠款</h6>
                  <p class="text-muted mb-2">在线缴纳或到服务台缴纳所有欠款</p>
                  <div class="text-muted">
                    <i class="fas fa-laptop"></i> 在线支付支持<br>
                    <i class="fas fa-university"></i> 服务台现金/校园卡
                  </div>
                </div>
              </div>
            </div>
          </div>

          <div class="row mt-3">
            <div class="col-md-6">
              <div class="card text-center">
                <div class="card-body">
                  <h6 class="mb-3"><i class="fas fa-id-card"></i> 证件注销手续</h6>
                  <p class="text-muted mb-2">办理读者证注销手续</p>
                  <div class="text-muted">
                    <i class="fas fa-clock"></i> 时间：8:00-17:00<br>
                    <i class="fas fa-map-marker-alt"></i> 地点：图书馆二楼服务台
                  </div>
                </div>
              </div>
            </div>
            <div class="col-md-6">
              <div class="card text-center">
                <div class="card-body">
                  <h6 class="mb-3"><i class="fas fa-warehouse"></i> 预约取消处理</h6>
                  <p class="text-muted mb-2">取消所有未完成的预约申请</p>
                  <div class="text-muted">
                    <i class="fas fa-undo"></i> 支持在线取消<br>
                    <i class="fas fa-comment-dollar"></i> 押金退还处理
                  </div>
                </div>
              </div>
            </div>
          </div>

          <div class="alert alert-warning mt-3" role="alert">
            <i class="fas fa-exclamation-triangle"></i>
            <strong>注意事项：</strong>
            <ol class="mb-0">
              <li>请携带学生证、身份证等有效证件</li>
              <li>建议提前1-2天开始办理，避免高峰期</li>
              <li>如有图书未归还或欠款未结清，需先处理完相关手续</li>
            </ol>
          </div>
        </div>
      </div>

      <!-- 特殊情况处理 -->
      <div class="card mb-4">
        <div class="card-header">
          <h5 class="mb-0"><i class="fas fa-exclamation-circle"></i> 特殊情况处理</h5>
        </div>
        <div class="card-body">
          <div class="row text-center">
            <div class="col-md-4 mb-3">
              <div class="card">
                <div class="card-body">
                  <i class="fas fa-book-open fa-2x text-danger mb-2"></i>
                  <h6>图书遗失申报</h6>
                  <p class="text-muted small">不慎遗失图书的申报处理</p>
                </div>
              </div>
            </div>
            <div class="col-md-4 mb-3">
              <div class="card">
                <div class="card-body">
                  <i class="fas fa-id-card fa-2x text-warning mb-2"></i>
                  <h6>证件丢失补办</h6>
                  <p class="text-muted small">读者证丢失的补办流程</p>
                </div>
              </div>
            </div>
            <div class="col-md-4 mb-3">
              <div class="card">
                <div class="card-body">
                  <i class="fas fa-calendar-plus fa-2x text-info mb-2"></i>
                  <h6>延期离校申请</h6>
                  <p class="text-muted small">特殊情况的延期离校申请</p>
                </div>
              </div>
            </div>
          </div>

          <div class="text-center mt-3">
            <button type="button" class="btn btn btn-primary" onclick="showSpecialHandling()">
              <i class="fas fa-paper-plane"></i> 提交特殊处理申请
            </button>
          </div>
        </div>
      </div>

      <!-- 证明文件管理 -->
      <div class="card mb-4">
        <div class="card-header d-flex justify-content-between align-items-center">
          <h5 class="mb-0"><i class="fas fa-file-alt"></i> 证明文件管理</h5>
          <div class="btn-group btn-group-sm">
            <button type="button" class="btn btn btn-primary" onclick="generateCertificate('NO_DEBT')">
              <i class="fas fa-shield-alt"></i> 无欠款证明
            </button>
            <button type="button" class="btn btn btn-success" onclick="generateCertificate('CLEARANCE')">
              <i class="fas fa-check-circle"></i> 清欠证明
            </button>
            <button type="button" class="btn btn btn-info" onclick="generateCertificate('TRANSCRIPT')">
              <i class="fas fa-file-alt"></i> 成绩单
            </button>
            <button type="button" class="btn btn btn-warning" onclick="generateCertificate('REFERENCE')">
              <i class="fas fa-user-graduate"></i> 推荐信
            </button>
          </div>
        </div>
        <div class="card-body mb-4">
          <div class="row mb-3">
            <div class="col-md-6">
              <h6>已生成证明</h6>
              <div class="list-group">
                <a href="#" class="list-group-item list-group-item-action" onclick="viewCertificate('CERT20240415001')">
                  <div class="d-flex justify-content-between">
                    <span>无欠款证明</span>
                    <small class="text-muted">生成时间：2024-04-15</small>
                    <span class="text-success">有效至：2024-12-31</span>
                  </div>
                </a>
                <a href="#" class="list-group-item list-group-item-action" onclick="viewCertificate('CERT20240410002')">
                  <div class="d-flex justify-content-between">
                    <span>清欠证明</span>
                    <small class="text-muted">生成时间：2024-04-10</small>
                    <span class="text-success">有效至：2024-06-30</span>
                  </div>
                </a>
              </div>
            </div>
            </div>
            <div class="col-md-6">
              <h6>证明文件管理</h6>
              <div class="list-group">
                <button type="button" class="list-group-item list-group-item-action text-left" onclick="shareCertificate('CERT20240415001')">
                  <i class="fas fa-share-alt mr-2"></i> 分享无欠款证明
                </button>
                <button type="button" class="list-group-item list-group-item-action text-left" onclick="downloadCertificate('CERT20240415001')">
                  <i class="fas fa-download mr-2"></i> 下载PDF
                </button>
              </div>
            </div>
          </div>
        </div>
        <div class="row">
              <div class="alert alert-info">
                <i class="fas fa-info-circle"></i>
                <strong>证明文件说明：</strong>
                <ul class="mb-0">
                  <li>所有证明文件均带有电子公章和防伪验证码</li>
                  <li>可用于就业、升学等场合，具有法律效力</li>
                  <li>证明文件有效期一般为6个月</li>
                  <li>建议妥善保存，避免信息泄露</li>
                </ul>
              </div>
        </div>
        </div>
      </div>
      <!-- 离校倒计时 -->
      <div class="card mb-4">
        <div class="card-header">
          <h5 class="mb-0"><i class="fas fa-hourglass-half"></i> 离校倒计时</h5>
        </div>
        <div class="card-body text-center">
          <div class="countdown-display">
            <h2 class="text-primary ">45</h2>
            <p class="text-muted">天</p>
          </div>
          <div class="progress" style="height: 10px;">
            <div class="progress-bar bg-warning" style="width: 87.5%"></div>
          </div>
          <p class="text-muted mt-2">预计离校日期：2024-05-30</p>
        </div>
        </div>
      </div>

      <!-- 常见问题 -->
      <div class="card mb-4">
        <div class="card-header">
          <h5 class="mb-0"><i class="fas fa-question-circle"></i> 常见问题</h5>
        </div>
        <div class="card-body">
          <div class="accordion" id="faqAccordion">
            <div class="card">
              <div class="card-header" id="faq1">
                <h6 class="mb-0">
                  <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#faqCollapse1">
                    离校需要准备哪些材料？
                  </button>
                </h6>
              </div>
              <div id="faqCollapse1" class="collapse" data-parent="#faqAccordion">
                <div class="card-body">
                  <ul>
                    <li>学生证、身份证原件及复印件</li>
                    <li>图书归还证明（如有）</li>
                    <li>欠款缴清证明</li>
                    <li>离校申请表（如有）</li>
                    <li>1寸、2寸证件照片各4张</li>
                    <li>其他学院相关部门要求的材料</li>
                  </ul>
                </div>
              </div>
            </div>
            <div class="card">
              <div class="card-header" id="faq2">
                <h6 class="mb-0">
                  <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#faqCollapse2">
                    图书遗失如何处理？
                  </button>
                </h6>
              </div>
              <div id="faqCollapse2" class="collapse" data-parent="#faqAccordion">
                <div class="card-body">
                  <p>请按以下步骤处理图书遗失：</p>
                  <ol>
                    <li>立即到图书馆服务台申报遗失</li>
                    <li>填写图书遗失申请表</li>
                    <li>根据图书价值和使用时间，按规定缴纳赔偿金</li>
                    <li>获取遗失证明书</li>
                    <li>赔偿金缴纳完成后，注销相关借阅记录</li>
                  </ol>
                </div>
              </div>
            </div>
            <div class="card">
              <div class="card-header" id="faq3">
                <h6 class="mb-0">
                  <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#faqCollapse3">
                    证件丢失怎么办？
                  </button>
                </h6>
              </div>
              <div id="faqCollapse3" class="collapse" data-parent="#faqAccordion">
                <div class="card-body">
                  <p>证件丢失处理流程：</p>
                  <ul>
                    <li>到图书馆服务台申报证件丢失</li>
                    <li>填写挂失申请表</li>
                    <li>提供身份证明材料</li>
                    <li>缴纳工本费重新办理</li>
                    <li>获取临时身份证明</li>
                  </ul>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 联系方式 -->
      <div class="card mb-4">
        <div class="card-header">
          <h5 class="mb-0"><i class="fas fa-phone-alt"></i> 联系方式</h5>
        </div>
        <div class="card-body">
          <div class="list-group">
            <div class="list-group-item">
              <i class="fas fa-building text-primary"></i>
              <strong>图书馆服务台</strong>
              <div class="text-muted">
                <p>电话：020-87654321</p>
                <p>邮箱：library@edu.cn</p>
                <p>工作时间：周一至周五 8:00-17:30</p>
              </div>
            </div>
            <div class="list-group-item">
              <i class="fas fa-user-tie text-success"></i>
              <strong>离校手续咨询</strong>
              <div class="text-muted">
                <p>电话：020-87654322</p>
                <p>邮箱：graduation@edu.cn</p>
                <p>工作时间：周一至周五 9:00-17:00</p>
              </div>
            </div>
            <div class="list-group-item">
              <i class="fas fa-tools text-info"></i>
              <strong>技术支持</strong>
              <div class="text-muted">
                <p>在线咨询：支持系统使用问题</p>
                <p>工作时间：7×24小时在线客服</p>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 校友服务 -->
      <div class="card mb-4">
        <div class="card-header">
          <h5 class="mb-0"><i class="fas fa-users"></i> 校友服务</h5>
        </div>
        <div class="card-body">
          <div class="alert alert-success">
            <i class="fas fa-gift"></i>
            <strong>欢迎成为校友！</strong>
            <p class="mb-2">毕业后您的账户将自动转换为校友账户，继续享受部分图书馆服务。</p>
          </div>
          <div class="list-group list-group-flush">
            <a href="#" class="list-group-item list-group-item-action">
              <i class="fas fa-graduation-cap mr-2"></i> 校友账户转换
            </a>
            <a href="#" class="list-group-item list-group-item-action">
              <i class="fas fa-book-reader mr-2"></i> 校友借阅权限
            </a>
            <a href="#" class="list-group-item list-group-item-action">
              <i class="fas fa-database mr-2"></i> 电子资源访问
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<!-- 离校申请模态框 -->
<div class="modal fade" id="graduationModal" tabindex="-1" role="dialog">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">申请离校手续</h5>
        <button type="button" class="close" data-dismiss="modal">
          <span>&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form class="custom-form" id="graduationForm">
          <div class="form-group">
            <label for="graduationType">离校类型 <span class="text-danger">*</span></label>
            <select class="form-control" id="graduationType" required>
              <option value="">请选择离校类型</option>
              <option value="GRADUATION">正常毕业离校</option>
              <option value="TRANSFER">转学离校</option>
              <option value="WITHDRAWAL">退学离校</option>
              <option value="OTHER">其他原因离校</option>
            </select>
          </div>
          <div class="form-group">
            <label for="expectedGraduationDate">预计毕业日期 <span class="text-danger">*</span></label>
            <input type="date" class="form-control" id="expectedGraduationDate" required>
          </div>
          <div class="form-group">
            <label for="specialRequirements">特殊要求说明</label>
            <textarea class="form-control" id="specialRequirements" rows="4" placeholder="如有特殊要求请在此说明"></textarea>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn btn-primary" onclick="submitGraduationApplication()">提交申请</button>
      </div>
    </div>
  </div>
</div>

[#include 'inc_footer.html'/]
<script>
// 模拟的静态数据
const graduationData = {
  status: {
    hasApplication: true,
    overallStatus: "PROCESSING",
    completionRate: 75,
    clearanceItems: [
      {
        itemType: "BOOK_RETURN",
        itemName: "归还所有借阅图书",
        status: "COMPLETED",
        completionTime: "2024-04-10 14:30:00"
      },
      {
        itemType: "FINE_PAYMENT",
        itemName: "缴清所有罚款",
        status: "PENDING",
        amount: 15.50,
        deadline: "2024-04-20"
      },
      {
        itemType: "RESERVATION_CANCEL",
        itemName: "取消预约申请",
        status: "COMPLETED"
      },
      {
        itemType: "EQUIPMENT_RETURN",
        itemName: "归还设备借用",
        status: "PENDING"
      }
    ],
    canApplyCertificate: false,
    estimatedCompletionDate: "2024-04-18",
    applications: [
      {
        id: 1,
        type: "GRADUATION",
        expectedDate: "2024-06-30",
        applicationDate: "2024-04-15 10:30:00",
        status: "PROCESSING",
        applicationNumber: "GRAD20240415001"
      }
    ],
    certificates: [
      {
        id: "CERT20240415001",
        type: "NO_DEBT",
        certificateNumber: "CERT20240415001",
        verificationCode: "VC20240415ABC",
        issueDate: "2024-04-15",
        expireDate: "2024-12-31",
        status: "ACTIVE"
      },
      {
        id: "CERT20240410002",
        type: "CLEARANCE",
        certificateNumber: "CERT20240410002",
        verificationCode: "VC20240410ABC",
        issueDate: "2024-04-10",
        expireDate: "2024-06-30",
        status: "ACTIVE"
      }
    ]
  }
};

// 功能函数
function showGraduationModal() {
  $('#graduationModal').modal('show');
}

function submitGraduationApplication() {
  const form = document.getElementById('graduationForm');
  if (form.checkValidity()) {
    alert('离校申请提交成功！我们会尽快处理您的申请。');
    $('#graduationModal').modal('hide');
    form.reset();
  } else {
    alert('请填写完整的申请信息！');
  }
}

function showSpecialHandling() {
  alert('显示特殊处理申请对话框');
}

function generateCertificate(type) {
  const typeMap = {
    'NO_DEBT': '无欠款证明',
    'CLEARANCE': '清欠证明',
    'TRANSCRIPT': '成绩单',
    'REFERENCE': '推荐信'
  };

  alert('正在生成' + typeMap[type] + '...');

  // 模拟生成证明
  setTimeout(function() {
    const newCertificate = {
      id: 'CERT' + Date.now(),
      type: type,
      certificateNumber: 'CERT' + Date.now(),
      verificationCode: 'VC' + Math.random().toString(36).substr(2, 6),
      issueDate: new Date().toISOString().split('T')[0],
      expireDate: new Date(Date.now() + 180 * 24 * 1000 * 3600 * 1000).toISOString().split('T')[0],
      status: 'ACTIVE'
    };

    graduationData.certificates.push(newCertificate);
    alert(typeMap[type] + '生成成功！证明编号：' + newCertificate.certificateNumber);
  }, 1500);
}

function viewCertificate(id) {
  const certificate = graduationData.certificates.find(c => c.id === id);
  if (certificate) {
    alert('查看证明详情：\n编号：' + certificate.certificateNumber + '\n类型：' + getCertificateTypeText(certificate.type) + '\n生成日期：' + certificate.issueDate + '\n有效期至：' + certificate.expireDate + '\n验证码：' + certificate.verificationCode);
  }
}

function getCertificateTypeText(type) {
  const typeMap = {
    'NO_DEBT': '无欠款证明',
    'CLEARANCE': '清欠证明',
    'TRANSCRIPT': '成绩单',
    'REFERENCE': '推荐信'
  };
  return typeMap[type] || type;
}

function shareCertificate(id) {
  alert('分享证明ID: ' + id + '\n分享链接：https://library.edu.cn/certificate/verify/' + id);
}

function downloadCertificate(id) {
  const certificate = graduationData.certificates.find(c => c.id === id);
  if (certificate) {
    // 模拟下载
    alert('下载证明PDF：' + certificate.certificateNumber + '.pdf');
    window.open('/api/graduation/certificate/' + id + '/download', '_blank');
  }
}

function updateCountdown() {
  // 这里应该实现倒计时逻辑
  const days = 45;
  const countdownDisplay = document.querySelector('.countdown-display h2');
  if (countdownDisplay) {
    countdownDisplay.textContent = days;
  }
}

// 页面初始化
document.addEventListener('DOMContentLoaded', function() {
  updateCountdown();
  setInterval(updateCountdown, 86400000); // 每天更新一次
});

// API调用统计
axios.get('${api}/channel/view/${channel.id?c}');
</script>

</body>
</html>
[/#escape]
